package kr.hkit.androidcomplete01.ch08;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

public class HandlerAccess extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Log.d("Activity Life Cycle", "onCreate()");
		final TextView mText; //final로 선언하라고 나옴..
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch08_handleraccess);
		
		mText = (TextView) findViewById(R.id.text);
		
		LinearLayout linear = (LinearLayout) findViewById(R.id.linear);
		linear.setOnTouchListener(new View.OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if(event.getAction()==MotionEvent.ACTION_DOWN){
					mText.setText("Touched");
				return true;
				}
				return false;
			}
		});
	}
	//생명주기 로그캣을 이용해서 확인해보자 어플실행 뒤로가기...Activity Life Cycle등록해서 확인할것...
	@Override
	protected void onStart() {
		Log.d("Activity Life Cycle", "onCreate()");
		super.onStart();
	}

	@Override
	protected void onRestart() {
		Log.d("Activity Life Cycle", "onRestart()");
		super.onRestart();
	}

	@Override
	protected void onResume() {
		Log.d("Activity Life Cycle", "onResume()");
		super.onResume();
	}

	@Override
	protected void onPause() {
		Log.d("Activity Life Cycle", "onPause()");
		super.onPause();
	}

	@Override
	protected void onStop() {
		Log.d("Activity Life Cycle", "onStop()");
		super.onStop();
	}

	@Override
	protected void onDestroy() {
		Log.d("Activity Life Cycle", "onDestroy()");
		super.onDestroy();
	}
	
	
}
